//
//  App.swift
//  SwiftSign
//
//  Created by continue on 2021/4/23.
//

import UIKit

final class App: NSObject {
    static let shared = App()
    
    var window: UIWindow?
    
    var provider: SwiftSignAPI?
    let navigator: Navigator
    
    private override init() {
        navigator = Navigator.default
        super.init()
        let signProvider = SignNetworking.stubbingSignNetworking();
        self.provider = RestApi(signProvider: signProvider)
    }
    
    func presentInitialScreen(in window: UIWindow) {
        self.window = window
        guard let provider = provider else { return }
        DispatchQueue.main.async {
            let viewModel = HomeViewModel(provider: provider)
            self.navigator.show(segue: .home(viewModel: viewModel), sender: nil, transition: .root(in: window))
        }
    }
}
